package com.zhongyu.base.consumer.service.lmpl;

import com.zhongyu.base.consumer.client.AreaClient;
import com.zhongyu.base.consumer.service.AreaService;
import com.zhongyu.base.consumer.vo.AreaVo;
import com.zhongyu.comm.pojo.Area;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

@Service("AreaService")
public class AreaServicelmpl implements AreaService {
    @Resource
    private AreaClient areaClient;

    @Override
    public List<AreaVo> searchAll() {
        List<Area>list=areaClient.findAll();
        return list.stream().map(area -> {
            AreaVo areaVo=new AreaVo();
           BeanUtils.copyProperties(area,areaVo);
            return areaVo;
        }).collect(Collectors.toList());

    }
}
